// 组件实例右侧 控制组件得配置项得表单类型
export interface baseFormElementType{
  type:'slot'|'input'|'inputNumber'|'switch'|'select'|'optionsSetting'|'optionsObjectSetting'|'colorPicker'|'customDataSource', //类型可以是任何类型只要在右侧渲染表单组件中有对应得组件实现即可
  slotName?:string,
  formItemConfig:{
    label:string,
    [key:string]:any
  },
  formItemElement:{
     modelValue:any,
     placeholder?:string,
     [key:string]:any
  }
}

export interface slotFormConfigType extends baseFormElementType{
 type:'slot',
 slotName:string, 
 formItemConfig:{
  label:string,
  [key:string]:any
},
formItemElement:{
   modelValue:any,
   placeholder:string,
   [key:string]:any
}
}

export interface inputFormConfigType  extends baseFormElementType{
  type:'input',
  formItemConfig:{
    label:string,
    [key:string]:any
  },
  formItemElement:{
     modelValue:string,
     placeholder:string,
     [key:string]:any
  }
}

export interface inputNumberFormConfigType  extends baseFormElementType{
  type:'inputNumber',
  formItemConfig:{
    label:string,
     [key:string]:any
  },
  formItemElement:{
     modelValue:number,
     placeholder:string,
     [key:string]:any
  }
}

export interface swichFormConfigType  extends baseFormElementType{
  type:'switch',
  formItemConfig:{
    label:string,
    [key:string]:any
  },
  formItemElement:{
     modelValue:boolean,
     [key:string]:any
  }
}

export interface selectFormConfigType<T>  extends baseFormElementType{
  type:'select',
  formItemConfig:{
    label:string,
     [key:string]:any
  },
  formItemElement:{
     modelValue:T,
     options:Array<{
       label:string,
       value:T
     }>,
     placeholder:string,
     [key:string]:any
  }
}


//增加数组结构的options 得自定义组件
export interface optionsSettingConfigType  extends baseFormElementType{
  type:'optionsSetting',  
  formItemConfig:{
    label:string,
    [key:string]:any
  },
  formItemElement:{
     modelValue:Array<{
       label:string,
       value:any
     }>,
   
     [key:string]:any
  }
}




//增加对象结构得options 得自定义组件
export interface optionsObjSettingConfigType  extends baseFormElementType{
  type:'optionsObjectSetting',  
  formItemConfig:{
    label:string,
    [key:string]:any
  },
  formItemElement:{
     modelValue:Object,
   
     [key:string]:any
  }
}

//通过自定义接口获取数据源 的组件 
export type dataSourceConfigType = {
  url: string
  headers: Array<{
    key:string,
    value:string,
}>
  method: 'GET' | 'POST' | 'PUT' | 'DELETE'
  params:Array<{
    key:string,
    value:string,
  }>
  data:Array<{
    key:string,
    value:string,
  }>
  beforeRequest: string //string 类型的函数通过eval执行
  afterRequest: string
}
export interface customDataSourceConfigType extends baseFormElementType{
  type:'customDataSource',
  formItemConfig:{
    label:string,
    [key:string]:any
  },
  formItemElement:{
     modelValue:Object,
     dataSourceConfig:dataSourceConfigType,
     [key:string]:any
  }
}


export interface colorPickConfigType  extends baseFormElementType{
  type:'colorPicker',
  formItemConfig:{
    label:string,
    [key:string]:any
  },
  formItemElement:{
     modelValue:string,
     [key:string]:any
  }
}